<?php

/**
 * Subclass for representing a row from the 'kernel.usuario' table.
 *
 * 
 *
 * @package plugins/kernel/lib.model
 */ 
class KernelUsuario extends BaseKernelUsuario
{
	/**
	 * Initializes internal state of KernelUsuario object.
	 * @see        parent::__construct()
	 */
	public function __construct()
	{
		// Make sure that parent constructor is always invoked, since that
		// is where any default values for this object are set.
		parent::__construct();
	}
  public function setClave($clave)
  {
    $aleatorio = md5(rand(100000, 999999).$this->getUsuario());
    $this->setAleatorio($aleatorio);
    $this->setSha1Clave(sha1($aleatorio.$clave));
  }
  public function getAccion()
  {
    if($this->isNew())
      return "Nuevo";
    else
      return "Editar";
  }
  public function __toString()
  {
    return $this->getUsuario();
  }
}
